/**
 * @author Mirko Bordjoski
 */	
package org.piwik.events
{
	import flash.events.Event;

	/**
	* The PiwikEvent class represents events that are dispatched by the Piwik engine.
	*/
	public class PiwikEvent extends Event
	{
		public static const LOADED:String = "piwik_loaded";
		//public static const IO_ERROR:String = "piwik_io_error";
		//public static const SECURITY_ERROR:String = "piwik_security_error";
		
		
		public var rawData:Object;
		public var requestType:String;
		public var data:Array;
		//public var errorMessage:String;
		
		
		public function PiwikEvent(type:String, 
									bubbles:Boolean=false, 
									cancelable:Boolean=false, 
									rawData:Object = null, 
									requestType:String = "undefined",
									data:Array = null
									)
		{
			super(type, bubbles, cancelable);
			
			this.rawData = rawData;
			this.data = data;
			this.requestType = requestType;
			//this.errorMessage = errorMessage;
		}
		

		public override function clone( ):Event 
		{
			return new PiwikEvent(type, bubbles, cancelable, rawData, requestType, data);
		}

		public override function toString( ):String 
		{
			return formatToString("PiwikEvent", "type", "bubbles",	"cancelable", "eventPhase", "rawData", "requestType","data");
		}
		
	}
}